package mt;


import java.util.LinkedList;
import java.util.Scanner;

public class meituan_0319_Main_3 {
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        int m1=cin.nextInt();//youxib
        int m2=cin.nextInt();//老年机
        LinkedList<int[]> m1list=new LinkedList<>();
        LinkedList<int[]> m2list=new LinkedList<>();
        for (int i = 0; i < m1; i++) {
            m1list.add(new int[2]);
            m1list.get(i)[0]=cin.nextInt();
        }
        for (int i = 0; i < m1; i++) {
            m1list.get(i)[1]=cin.nextInt();
        }
        for (int i = 0; i < m2; i++) {
            m2list.add(new int[2]);
            m2list.get(i)[0]=cin.nextInt();
        }
        for (int i = 0; i < m2; i++) {
            m2list.get(i)[1]=cin.nextInt();
        }
        int res=0;
        int i=0,j=0;
        while (i<m1&&j<m2){
            int[] m1l = m1list.get(i);
            int[] m2l = m2list.get(j);
            if (m1l[0]<=m2l[1]||m1l[1]>=m2l[0]){
                //有交集
                res+=Math.min(m1l[1],m2l[1])-Math.max(m1l[0],m2l[0])+1;
            }
            if (m1l[1]<m2l[1]){
                    i++;
            }else if (m1l[1]==m2l[1]){
                    j++;
                    i++;
            }else {
                j++;
            }

        }
        System.out.println(res);
    }
}
